Dwarf Manager

Why .NET? To find out what the Ximian Mono people are excited about, and learn more about Web Services.

The Dwarf Manager is an exploratory project using .NET, C#, COM+, Web Services, SOAP, ASP.NET, and other technologies. These web pages are not dynamically hosted, so I will be presenting static snapshots of the original site. The original site runs on Windows XP Professional, IIS, and SQL Server 2000 Desktop Engine. It also uses the Transaction Server features of COM+.

This application is used to manage dwarves. Mountains and dwarves can be added, and associated with one another. Here are the main web pages, and the ASP.NET pages used to generate them:

Web PageASP.NET Source Page (View->Source)
Dwarf (main page) dwarf.aspx
Add Dwarf AddDwarf.aspx
Dwarf Details (edit) DwarfDetails.aspx
Add Mountain AddMountain.aspx
Mountain Details (edit) MountainDetails.aspx
Marry Dwarves MarryDwarves.aspx
Note auto-generated client-side field validation javascript has been removed from web pages.

All dynamic information is stored in SQL Server:

Database stored procedures were not used because I wanted to experiment with maintaining all transactions and business logic in the COM+ middle tier. C# .NET Components were created as subclasses of ServicedComponent so they could utilize COM+ transaction support. Declarative transaction attributes [Transaction(TransactionOption.Required)] and [AutoComplete] were added to classes and methods instead of manual transaction control. I tested throwing a divide-by-zero exception inside of a composite transactional method (DwarfMgr.Marry()) and the transaction was correctly rolled back. The following C# classes were created: Note these classes are similar to using stateless-session beans in Enterprise Java Beans. Traditionally the Get*() methods would return a list of class-specific objects. Leaving the data in the ADO.NET DataSet returned by the SQL query allows for simple transfer via SOAP. Many ASP.NET Web Forms controls also interface directly with DataSets.

.NET also automates the creation of SOAP Web Service interfaces for applications. I created a single .asmx file which specified the SOAP interfaces:

From this file IIS automatically generates a WSDL (Web Services Description Language) file and a series of browser pages useful for testing. Note the C# code can simply return an ADO.NET DataSet and IIS automatically transforms it into SOAP: The SOAP interface can also be used to support desktop clients. The wsdl tool is used generate C# proxy code from the WSDL file: This can be combined with a simple C# Windows Forms program to produce a desktop application which automatically connects to the web service:

If you want to play with the code it is all available here.